﻿using System;

namespace Entities
{
    public enum ImageType
    {
        Pole,
        Meter,
        Transformer,
        Recloser,
        Sectionalizer,
        None
    }

    public class EImage : EBase
    {
        #region Fields

        protected string m_FileName;
        private bool m_IsDeleted;
        public string TempFileName{get;set;}
        public string PrefixFileName{get;set;}
        public ImageType ImageType { get; set; }
        
        #endregion

        #region Properties
        
        public string FileName
        {
            get
            {
                return m_FileName;
            }
            set
            {
                m_FileName = value;
            }
        }
        public bool IsDeleted
        {
            get
            {
                return m_IsDeleted;
            }
            set
            {
                m_IsDeleted = value;
            }
        }
        
        #endregion

        #region - Constructors -

        public EImage()
        {
            m_FileName = string.Empty;
            Id = Int32.MinValue;
            m_IsDeleted = false;
        }
        
        public EImage(string fileName) : this()
        {
            m_FileName = fileName;
        }

        #endregion

        #region - Public methods -

        public void GenerateNewName(string prefix)
        {
            TempFileName = m_FileName;

            switch(ImageType)
            {
                case Entities.ImageType.Pole:
                    m_FileName = "Photo_" + prefix + ".jpg";
                    break;
                case Entities.ImageType.Meter:
                    m_FileName = "MeterPhoto_" + prefix + ".jpg";
                    break;
                case Entities.ImageType.Transformer:
                    m_FileName = "TransformerPhoto_" + prefix + ".jpg";
                    break;
                case Entities.ImageType.Sectionalizer:
                    m_FileName = "SectionalizerPhoto_" + prefix + ".jpg";
                    break;
                case Entities.ImageType.Recloser:
                    m_FileName = "RecloserPhoto_" + prefix + ".jpg";
                    break;

            }
        }

        #endregion
    }
}
